/* hooks */
import { useSettingListPage } from "@src/modules/setting/gpt/hooks/page"
/* vue */
import { computed, ComputedRef, ref } from "vue"
import { EmitFn } from "vue/types/v3-setup-context"

function useSettingListSearch(emit?: EmitFn) {
  
  const { 
    getPageNum, 
    getPageSize, 
    setPageNum, 
    setPageSize,
    resetPage,
  } = useSettingListPage(emit)
  
  const keyword = ref('')
  
  const setKeyword = (val: string) => {
    keyword.value = val
  }
  
  const searchParams = computed(() => {
    return {
      pageNum: getPageNum(),
      pageSize: getPageSize(),
      keyword: keyword.value
    }
  })
  
  return {
    searchParams,
    resetPage,
    setPageNum,
    setPageSize,
    setKeyword
  }
  
}

export {
  useSettingListSearch
}
